<template>
  <div>
    <NavBar>
      <div slot="left" class="back" @click="back2home">
        <img src="~assets/img/common/back.svg">

      </div>

      <div slot="center" class="title">
        <div v-for="(item,index) in titles" :key="item.label"
              class="title-item"
             @click="itemclick(index)"
              :class="{activate: index === currentindex}">
          {{item}}
        </div>

      </div>


    </NavBar>



  </div>
</template>

<script>
  import NavBar from "components/common/navbar/NavBar";


  export default {
    name: "DetailNavBar",
    data(){
      return {
        titles:['漫画','详情','评论','推荐'],
        currentindex:0,
      }
    },
    components: {
      NavBar
    },
    methods:{
      itemclick(index){
        this.currentindex=index
        this.$emit('gettoother',index)
      },
      back2home(){
        this.$router.back()
      }
    }

  }
</script>

<style scoped>
  .title{
    display: flex;
    font-size: 15px;
  }

  .title-item{
    flex:1;
  }

  .activate{
    color: #42ffde;
  }

  .back{
    margin-top: 5px;
  }
</style>
